package com.kaiwukj.android.ufamily.utils;

import com.blankj.utilcode.util.TimeUtils;

import java.text.DecimalFormat;
import java.util.Date;

public class FormatUtils {

    /**
     * @param price 价格
     * @return string
     */
    public static String formatPrice(Double price) {
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(price);
    }

    public static String formatYuan(Double price) {
        return String.format("¥%s", formatPrice(price));
    }

    public static String formatTime(String time) {
        return formatTime(time, "yyyy-MM-dd HH:mm");
    }

    public static String formatTime(String time, String pattern) {
        Date date = TimeUtils.string2Date(time);
        return TimeUtils.date2String(date, pattern);
    }


}
